\chapter{Funcionalidade implementada}
\label{ap:jdbc-impl}

Este anexo apresenta uma lista da funcionalidade da API JDBC implementada pelo driver. Fica assim uma referência para a utilização do driver.

\section{Implementação JDBC}

As Tabelas \ref{tab:driverimpl}, \ref{tab:statementimpl} e \ref{tab:rsimpl} apresentam as interfaces do JDBC implementadas.

\begin{table}[H]
  \caption{Métodos implementados da interface \emph{Driver}}
  \label{tab:driverimpl}
  \centering
  \begin{tabular}{|l|l|}
    \hline
    \head{} & \head{Nome}
    \\ \hline
    \texttt{boolean} & acceptsURL(String url) 
    \\ \hline
    \texttt{Connection} & connect(String url, Properties info) 
    \\ \hline
    \texttt{int} & getMajorVersion() 
    \\ \hline
    \texttt{int} & getMinorVersion() 
    \\ \hline
    \texttt{boolean} & jdbcCompliant() 
    \\ \hline
  \end{tabular}
\end{table}

\begin{table}[H]
  \caption{Métodos implementados da interface \emph{Statement}}
  \label{tab:statementimpl}
  \centering
  \begin{tabular}{|l|l|}
    \hline
    \head{} & \head{Nome}
    \\ \hline
    \texttt{void} & addBatch(String sql) 
    \\ \hline
%    \texttt{void} & cancel() 
%    \\ \hline
    \texttt{void} & clearBatch() 
    \\ \hline
%    \texttt{void} & clearWarnings() 
%    \\ \hline
    \texttt{void} & close() 
    \\ \hline
%    \texttt{boolean} & execute(String sql) 
%    \\ \hline
%    \texttt{boolean} & execute(String sql, int autoGeneratedKeys) 
%    \\ \hline
%    \texttt{boolean} & execute(String sql, int[] columnIndexes) 
%    \\ \hline
%    \texttt{boolean} & execute(String sql, String[] columnNames) 
%    \\ \hline
    \texttt{int[]} & executeBatch() 
    \\ \hline
    \texttt{ResultSet} & executeQuery(String sql) 
    \\ \hline
    \texttt{int} & executeUpdate(String sql) 
    \\ \hline
%    \texttt{int} & executeUpdate(String sql, int autoGeneratedKeys) 
%    \\ \hline
%    \texttt{int} & executeUpdate(String sql, int[] columnIndexes) 
%    \\ \hline
%    \texttt{int} & executeUpdate(String sql, String[] columnNames) 
%    \\ \hline
%    \texttt{Connection} & getConnection() 
%    \\ \hline
%    \texttt{int} & getFetchDirection() 
%    \\ \hline
%    \texttt{int} & getFetchSize() 
%    \\ \hline
%    \texttt{ResultSet} & getGeneratedKeys() 
%    \\ \hline
%    \texttt{int} & getMaxFieldSize() 
%    \\ \hline
%    \texttt{int} & getMaxRows() 
%    \\ \hline
%    \texttt{boolean} & getMoreResults() 
%    \\ \hline
%    \texttt{boolean} & getMoreResults(int current) 
%    \\ \hline
%    \texttt{int} & getQueryTimeout() 
%    \\ \hline
%    \texttt{ResultSet} & getResultSet() 
%    \\ \hline
%    \texttt{int} & getResultSetConcurrency() 
%    \\ \hline
%    \texttt{int} & getResultSetHoldability() 
%    \\ \hline
%    \texttt{int} & getResultSetType() 
%    \\ \hline
%    \texttt{int} & getUpdateCount() 
%    \\ \hline
%    \texttt{SQLWarning} & getWarnings() 
%    \\ \hline
%    \texttt{boolean} & isClosed() 
%    \\ \hline
%    \texttt{boolean} & isPoolable() 
%    \\ \hline
%    \texttt{void} & setCursorName(String name) 
%    \\ \hline
%    \texttt{void} & setEscapeProcessing(boolean enable) 
%    \\ \hline
%    \texttt{void} & setFetchDirection(int direction) 
%    \\ \hline
%    \texttt{void} & setFetchSize(int rows) 
%    \\ \hline
%    \texttt{void} & setMaxFieldSize(int max) 
%    \\ \hline
%    \texttt{void} & setMaxRows(int max) 
%    \\ \hline
%    \texttt{void} & setPoolable(boolean poolable) 
%    \\ \hline
%    \texttt{void} & setQueryTimeout(int seconds) 
%    \\ \hline
  \end{tabular}
\end{table}

\begin{table}[H]
  \caption{Métodos implementados da interface \emph{ResultSet}}
  \label{tab:rsimpl}
  \centering
  \begin{tabular}{|l|l|}
    \hline
    \head{} & \head{Nome}
    \\ \hline
    \texttt{boolean} & absolute(int row) 
    \\ \hline
    \texttt{void} & afterLast() 
    \\ \hline
    \texttt{void} & beforeFirst() 
    \\ \hline
    \texttt{void} & cancelRowUpdates() 
    \\ \hline
%   \texttt{void} & clearWarnings() 
%   \\ \hline
    \texttt{void} & close() 
    \\ \hline
    \texttt{void} & deleteRow() 
    \\ \hline
%    \texttt{int} & findColumn(String columnLabel) 
%    \\ \hline
    \texttt{boolean} & first() 
    \\ \hline
%    \texttt{InputStream} & getAsciiStream(int columnIndex) 
%    \\ \hline
%    \texttt{InputStream} & getAsciiStream(String columnLabel) 
%    \\ \hline
%    \texttt{InputStream} & getBinaryStream(int columnIndex) 
%    \\ \hline
%    \texttt{InputStream} & getBinaryStream(String columnLabel) 
%    \\ \hline
%    \texttt{boolean} & getBoolean(int columnIndex) 
%    \\ \hline
%    \texttt{boolean} & getBoolean(String columnLabel) 
%    \\ \hline
%    \texttt{int} & getConcurrency() 
%    \\ \hline
%    \texttt{String} & getCursorName() 
%    \\ \hline
    \texttt{Date} & getDate(int columnIndex) 
    \\ \hline
%    \texttt{Date} & getDate(int columnIndex, Calendar cal) 
%    \\ \hline
%    \texttt{Date} & getDate(String columnLabel) 
%    \\ \hline
%    \texttt{Date} & getDate(String columnLabel, Calendar cal) 
%    \\ \hline
    \texttt{double} & getDouble(int columnIndex) 
    \\ \hline
%    \texttt{double} & getDouble(String columnLabel) 
%    \\ \hline
%    \texttt{int} & getFetchDirection() 
%    \\ \hline
    \texttt{int} & getFetchSize() 
    \\ \hline
%    \texttt{float} & getFloat(int columnIndex) 
%    \\ \hline
%    \texttt{float} & getFloat(String columnLabel) 
%    \\ \hline
%    \texttt{int} & getHoldability() 
%    \\ \hline
    \texttt{int} & getInt(int columnIndex) 
    \\ \hline
%    \texttt{int} & getInt(String columnLabel) 
%    \\ \hline
%    \texttt{long} & getLong(int columnIndex) 
%    \\ \hline
%    \texttt{long} & getLong(String columnLabel) 
%    \\ \hline
%    \texttt{ResultSetMetaData} & getMetaData() 
%    \\ \hline
%    \texttt{String} & getNString(int columnIndex) 
%    \\ \hline
%    \texttt{String} & getNString(String columnLabel) 
%    \\ \hline
    \texttt{int} & getRow() 
    \\ \hline
%    \texttt{short} & getShort(int columnIndex) 
%    \\ \hline
%    \texttt{short} & getShort(String columnLabel) 
%    \\ \hline
%    \texttt{Statement} & getStatement() 
%    \\ \hline
    \texttt{String} & getString(int columnIndex) 
    \\ \hline
%    \texttt{String} & getString(String columnLabel) 
%    \\ \hline
%    \texttt{Time} & getTime(int columnIndex) 
%    \\ \hline
%    \texttt{Time} & getTime(int columnIndex, Calendar cal) 
%    \\ \hline
%    \texttt{Time} & getTime(String columnLabel) 
%    \\ \hline
%    \texttt{Time} & getTime(String columnLabel, Calendar cal) 
%    \\ \hline
%    \texttt{Timestamp} & getTimestamp(int columnIndex) 
%    \\ \hline
%    \texttt{Timestamp} & getTimestamp(int columnIndex, Calendar cal) 
%    \\ \hline
%    \texttt{Timestamp} & getTimestamp(String columnLabel) 
%    \\ \hline
%    \texttt{Timestamp} & getTimestamp(String columnLabel, Calendar cal) 
%    \\ \hline
%    \texttt{int} & getType() 
%    \\ \hline
%    \texttt{InputStream} & getUnicodeStream(int columnIndex) 
%    \\ \hline
%    \texttt{InputStream} & getUnicodeStream(String columnLabel) 
%    \\ \hline
%    \texttt{URL} & getURL(int columnIndex) 
%    \\ \hline
%    \texttt{URL} & getURL(String columnLabel) 
%    \\ \hline
%    \texttt{SQLWarning} & getWarnings() 
%    \\ \hline
    \texttt{void} & insertRow() 
    \\ \hline
    \texttt{boolean} & isAfterLast() 
    \\ \hline
    \texttt{boolean} & isBeforeFirst() 
    \\ \hline
    \texttt{boolean} & isClosed() 
    \\ \hline
    \texttt{boolean} & isFirst() 
    \\ \hline
    \texttt{boolean} & isLast() 
    \\ \hline
    \texttt{boolean} & last() 
    \\ \hline
    \texttt{void} & moveToCurrentRow() 
    \\ \hline
    \texttt{void} & moveToInsertRow() 
    \\ \hline
    \texttt{boolean} & next() 
    \\ \hline
    \texttt{boolean} & previous() 
    \\ \hline
    \texttt{void} & refreshRow() 
    \\ \hline
    \texttt{boolean} & relative(int rows) 
    \\ \hline
%    \texttt{boolean} & rowDeleted() 
%    \\ \hline
%    \texttt{boolean} & rowInserted() 
%    \\ \hline
%    \texttt{boolean} & rowUpdated() 
%    \\ \hline
%    \texttt{void} & setFetchDirection(int direction) 
%    \\ \hline
    \texttt{void} & setFetchSize(int rows) 
    \\ \hline
%    \texttt{void} & updateArray(int columnIndex, Array x) 
%    \\ \hline
%    \texttt{void} & updateArray(String columnLabel, Array x) 
%    \\ \hline
%    \texttt{void} & updateAsciiStream(int columnIndex, InputStream x) 
%    \\ \hline
%    \texttt{void} & updateAsciiStream(int columnIndex, InputStream x, int length) 
%    \\ \hline
%    \texttt{void} & updateAsciiStream(int columnIndex, InputStream x, long length) 
%    \\ \hline
%    \texttt{void} & updateAsciiStream(String columnLabel, InputStream x) 
%    \\ \hline
%    \texttt{void} & updateAsciiStream(String columnLabel, InputStream x, int length) 
%    \\ \hline
%    \texttt{void} & updateAsciiStream(String columnLabel, InputStream x, long length) 
%    \\ \hline
%    \texttt{void} & updateBigDecimal(int columnIndex, BigDecimal x) 
%    \\ \hline
%    \texttt{void} & updateBigDecimal(String columnLabel, BigDecimal x) 
%    \\ \hline
%    \texttt{void} & updateBinaryStream(int columnIndex, InputStream x) 
%    \\ \hline
%    \texttt{void} & updateBinaryStream(int columnIndex, InputStream x, int length) 
%    \\ \hline
%    \texttt{void} & updateBinaryStream(int columnIndex, InputStream x, long length) 
%    \\ \hline
%    \texttt{void} & updateBinaryStream(String columnLabel, InputStream x) 
%    \\ \hline
%    \texttt{void} & updateBinaryStream(String columnLabel, InputStream x, int length) 
%    \\ \hline
%    \texttt{void} & updateBinaryStream(String columnLabel, InputStream x, long length) 
%    \\ \hline
%    \texttt{void} & updateBlob(int columnIndex, Blob x) 
%    \\ \hline
%    \texttt{void} & updateBlob(int columnIndex, InputStream inputStream) 
%    \\ \hline
%    \texttt{void} & updateBlob(int columnIndex, InputStream inputStream, long length) 
%    \\ \hline
%    \texttt{void} & updateBlob(String columnLabel, Blob x) 
%    \\ \hline
%    \texttt{void} & updateBlob(String columnLabel, InputStream inputStream) 
%    \\ \hline
%    \texttt{void} & updateBlob(String columnLabel, InputStream inputStream, long length) 
%    \\ \hline
%    \texttt{void} & updateBoolean(int columnIndex, boolean x) 
%    \\ \hline
%    \texttt{void} & updateBoolean(String columnLabel, boolean x) 
%    \\ \hline
%    \texttt{void} & updateByte(int columnIndex, byte x) 
%    \\ \hline
%    \texttt{void} & updateByte(String columnLabel, byte x) 
%    \\ \hline
%    \texttt{void} & updateBytes(int columnIndex, byte[] x) 
%    \\ \hline
%    \texttt{void} & updateBytes(String columnLabel, byte[] x) 
%    \\ \hline
%    \texttt{void} & updateCharacterStream(int columnIndex, Reader x) 
%    \\ \hline
%    \texttt{void} & updateCharacterStream(int columnIndex, Reader x, int length) 
%    \\ \hline
%    \texttt{void} & updateCharacterStream(int columnIndex, Reader x, long length) 
%    \\ \hline
%    \texttt{void} & updateCharacterStream(String columnLabel, Reader reader) 
%    \\ \hline
%    \texttt{void} & updateCharacterStream(String columnLabel, Reader reader, int length) 
%    \\ \hline
%    \texttt{void} & updateCharacterStream(String columnLabel, Reader reader, long length) 
%    \\ \hline
%    \texttt{void} & updateClob(int columnIndex, Clob x) 
%    \\ \hline
%    \texttt{void} & updateClob(int columnIndex, Reader reader) 
%    \\ \hline
%    \texttt{void} & updateClob(int columnIndex, Reader reader, long length) 
%    \\ \hline
%    \texttt{void} & updateClob(String columnLabel, Clob x) 
%    \\ \hline
%    \texttt{void} & updateClob(String columnLabel, Reader reader) 
%    \\ \hline
%    \texttt{void} & updateClob(String columnLabel, Reader reader, long length) 
%    \\ \hline
    \texttt{void} & updateDate(int columnIndex, Date x) 
    \\ \hline
%    \texttt{void} & updateDate(String columnLabel, Date x) 
%    \\ \hline
    \texttt{void} & updateDouble(int columnIndex, double x) 
    \\ \hline
%    \texttt{void} & updateDouble(String columnLabel, double x) 
%    \\ \hline
%    \texttt{void} & updateFloat(int columnIndex, float x) 
%    \\ \hline
%    \texttt{void} & updateFloat(String columnLabel, float x) 
%    \\ \hline
    \texttt{void} & updateInt(int columnIndex, int x) 
    \\ \hline
%    \texttt{void} & updateInt(String columnLabel, int x) 
%    \\ \hline
%    \texttt{void} & updateLong(int columnIndex, long x) 
%    \\ \hline
%    \texttt{void} & updateLong(String columnLabel, long x) 
%    \\ \hline
%    \texttt{void} & updateNCharacterStream(int columnIndex, Reader x) 
%    \\ \hline
%    \texttt{void} & updateNCharacterStream(int columnIndex, Reader x, long length) 
%    \\ \hline
%    \texttt{void} & updateNCharacterStream(String columnLabel, Reader reader) 
%    \\ \hline
%    \texttt{void} & updateNCharacterStream(String columnLabel, Reader reader, long length) 
%    \\ \hline
%    \texttt{void} & updateNClob(int columnIndex, NClob nClob) 
%    \\ \hline
%    \texttt{void} & updateNClob(int columnIndex, Reader reader) 
%    \\ \hline
%    \texttt{void} & updateNClob(int columnIndex, Reader reader, long length) 
%    \\ \hline
%    \texttt{void} & updateNClob(String columnLabel, NClob nClob) 
%    \\ \hline
%    \texttt{void} & updateNClob(String columnLabel, Reader reader) 
%    \\ \hline
%    \texttt{void} & updateNClob(String columnLabel, Reader reader, long length) 
%    \\ \hline
%    \texttt{void} & updateNString(int columnIndex, String nString) 
%    \\ \hline
%    \texttt{void} & updateNString(String columnLabel, String nString) 
%    \\ \hline
%    \texttt{void} & updateNull(int columnIndex) 
%    \\ \hline
%    \texttt{void} & updateNull(String columnLabel) 
%    \\ \hline
%    \texttt{void} & updateObject(int columnIndex, Object x) 
%    \\ \hline
%    \texttt{void} & updateObject(int columnIndex, Object x, int scaleOrLength) 
%    \\ \hline
%    \texttt{void} & updateObject(String columnLabel, Object x) 
%    \\ \hline
%    \texttt{void} & updateObject(String columnLabel, Object x, int scaleOrLength) 
%    \\ \hline
%    \texttt{void} & updateRef(int columnIndex, Ref x) 
%    \\ \hline
%    \texttt{void} & updateRef(String columnLabel, Ref x) 
%    \\ \hline
    \texttt{void} & updateRow() 
    \\ \hline
%    \texttt{void} & updateRowId(int columnIndex, RowId x) 
%    \\ \hline
%    \texttt{void} & updateRowId(String columnLabel, RowId x) 
%    \\ \hline
%    \texttt{void} & updateShort(int columnIndex, short x) 
%    \\ \hline
%    \texttt{void} & updateShort(String columnLabel, short x) 
%    \\ \hline
%    \texttt{void} & updateSQLXML(int columnIndex, SQLXML xmlObject) 
%    \\ \hline
%    \texttt{void} & updateSQLXML(String columnLabel, SQLXML xmlObject) 
%    \\ \hline
    \texttt{void} & updateString(int columnIndex, String x) 
    \\ \hline
%    \texttt{void} & updateString(String columnLabel, String x) 
%    \\ \hline
%    \texttt{void} & updateTime(int columnIndex, Time x) 
%    \\ \hline
%    \texttt{void} & updateTime(String columnLabel, Time x) 
%    \\ \hline
%    \texttt{void} & updateTimestamp(int columnIndex, Timestamp x) 
%    \\ \hline
%    \texttt{void} & updateTimestamp(String columnLabel, Timestamp x) 
%    \\ \hline
    \texttt{boolean} & wasNull() 
   \\ \hline 
  \end{tabular}
\end{table}

\section{Implementação TDS}

O \glssymbol{tds} especifica o formato como o SQL Server recebe e envia um valor, por isso o driver tem de conhecer esse formato para conseguir comunicar com sucesso com o servidor. Como existem vários tipos suportados pelo SQL Server \cite{SQLSDATATYPES} e o driver implementado apenas suporta alguns, a Tabela \ref{tab:sqltypes} apresenta a referência dos tipos suportados. Como o facto de uma coluna permitir ou não valores nulos pode alterar o formato, a segunda coluna da Tabela \ref{tab:sqltypes} indica o suporte relativo a esta característica.

\begin{table}[H]
  \caption{Tipos SQL suportados pelo driver.}
  \label{tab:sqltypes}
  \centering
  \begin{tabular}{|l|l|}
    \hline
    \head{Nome} & \head{Null/Not Null}
    \\ \hline
    INT & S/S
    \\ \hline
    FLOAT & S/S
    \\ \hline
    DATETIME & S/S
    \\ \hline
    NVARCHAR & S/S
    \\ \hline
  \end{tabular}
\end{table}
